package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the depotgoods database table.
 * 
 */
@Entity
@Table(name="depotgoods")
@NamedQuery(name="Depotgood.findAll", query="SELECT d FROM Depotgood d")
public class Depotgood implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int dnum;

	private int cnum;

	@Temporal(TemporalType.DATE)
	private Date cproducetime;

	private int ddtime;

	private int douts;

	private int dsurplu;

	private int dtotal;

	//bi-directional many-to-one association to Depotgoodsshelf
	@ManyToOne
	@JoinColumn(name="dgsnum")
	private Depotgoodsshelf depotgoodsshelf;

	//bi-directional many-to-one association to Supplier
	@ManyToOne
	@JoinColumn(name="supplier")
	private Supplier supplierBean;

	//bi-directional many-to-one association to Instock
	@OneToMany(mappedBy="depotgood")
	private List<Instock> instocks;

	//bi-directional many-to-one association to Treasury
	@OneToMany(mappedBy="depotgood")
	private List<Treasury> treasuries;

	public Depotgood() {
	}

	public int getDnum() {
		return this.dnum;
	}

	public void setDnum(int dnum) {
		this.dnum = dnum;
	}

	public int getCnum() {
		return this.cnum;
	}

	public void setCnum(int cnum) {
		this.cnum = cnum;
	}

	public Date getCproducetime() {
		return this.cproducetime;
	}

	public void setCproducetime(Date cproducetime) {
		this.cproducetime = cproducetime;
	}

	public int getDdtime() {
		return this.ddtime;
	}

	public void setDdtime(int ddtime) {
		this.ddtime = ddtime;
	}

	public int getDouts() {
		return this.douts;
	}

	public void setDouts(int douts) {
		this.douts = douts;
	}

	public int getDsurplu() {
		return this.dsurplu;
	}

	public void setDsurplu(int dsurplu) {
		this.dsurplu = dsurplu;
	}

	public int getDtotal() {
		return this.dtotal;
	}

	public void setDtotal(int dtotal) {
		this.dtotal = dtotal;
	}

	public Depotgoodsshelf getDepotgoodsshelf() {
		return this.depotgoodsshelf;
	}

	public void setDepotgoodsshelf(Depotgoodsshelf depotgoodsshelf) {
		this.depotgoodsshelf = depotgoodsshelf;
	}

	public Supplier getSupplierBean() {
		return this.supplierBean;
	}

	public void setSupplierBean(Supplier supplierBean) {
		this.supplierBean = supplierBean;
	}

	public List<Instock> getInstocks() {
		return this.instocks;
	}

	public void setInstocks(List<Instock> instocks) {
		this.instocks = instocks;
	}

	public Instock addInstock(Instock instock) {
		getInstocks().add(instock);
		instock.setDepotgood(this);

		return instock;
	}

	public Instock removeInstock(Instock instock) {
		getInstocks().remove(instock);
		instock.setDepotgood(null);

		return instock;
	}

	public List<Treasury> getTreasuries() {
		return this.treasuries;
	}

	public void setTreasuries(List<Treasury> treasuries) {
		this.treasuries = treasuries;
	}

	public Treasury addTreasury(Treasury treasury) {
		getTreasuries().add(treasury);
		treasury.setDepotgood(this);

		return treasury;
	}

	public Treasury removeTreasury(Treasury treasury) {
		getTreasuries().remove(treasury);
		treasury.setDepotgood(null);

		return treasury;
	}

}